package com.example.common;


import com.example.annotation.ConditionOnSystem;
import com.example.annotation.EnableHelloSelector;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Map;

public class SystemCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        Map<String, Object> metaData = annotatedTypeMetadata.getAnnotationAttributes(ConditionOnSystem.class.getName());

        String value = (String) metaData.get("value");

        return value.equals("widows");
    }
}
